CheckBox
| Kind of class: | class |
|---|---|
| Inherits from: | Button < UIComponent < MovieClip |
| Classpath: | gfx.controls.CheckBox |
| File last modified: | Tuesday, 29 June 2010, 09:03:27 |
The CheckBox is a Button component that is set to toggle the selected state when clicked. CheckBoxes are used to display and change a true/false (Boolean) value. It is functionally equivalent to the ToggleButton, but sets the toggle property implicitly.
Inspectable Properties
Since it derives from the Button control, the CheckBox contains the same inspectable properties as the Button with the omission of the toggle and disableFocus properties.
Due to its toggle property, the CheckBox requires another set of keyframes to denote the selected state. These states include
Events
All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
Inspectable Properties
Since it derives from the Button control, the CheckBox contains the same inspectable properties as the Button with the omission of the toggle and disableFocus properties.
- label: Sets the label of the Button.
- visible: Hides the button if set to false.
- disabled: Disables the button if set to true.
- disableFocus: By default buttons receive focus for user interactions. Setting this property to true will disable focus acquisition.
- disableConstraints: The Button component contains a constraints object that determines the placement and scaling of the textField inside of the button when the component is resized. Setting this property to true will disable the constraints object. This is particularly useful if there is a need to resize or reposition the button's textField via a timeline animation and the button component is never resized. If not disabled, the textField will be moved and scaled to its default values throughout its lifetime, thus nullifying any textField translation/scaling tweens that may have been created in the button's timeline.
- data: Custom string that can be attached to the component as seperate data than the CheckBox's label.
- selected: Checks (or selects) the CheckBox when set to true.
- autoSize: Determines if the button will scale to fit the text that it contains and which direction to align the resized button. Setting the autoSize property to
autoSize="none"will leave its current size unchanged. - enableInitCallback: If set to true, _global.CLIK_loadCallback() will be fired when a component is loaded and _global.CLIK_unloadCallback will be called when the component is unloaded. These methods receive the instance name, target path, and a reference the component as parameters. _global.CLIK_loadCallback and _global.CLIK_unloadCallback should be overriden from the game engine using GFx FunctionObjects.
- soundMap: Mapping between events and sound process. When an event is fired, the associated sound process will be fired via _global.gfxProcessSound, which should be overriden from the game engine using GFx FunctionObjects.
Due to its toggle property, the CheckBox requires another set of keyframes to denote the selected state. These states include
- an up or default state.
- an over state when the mouse cursor is over the component, or when it is focused.
- a down state when the button is pressed.
- a disabled state.
- a selected_up or default state.
- a selected_over state when the mouse cursor is over the component, or when it is focused.
- a selected_down state when the button is pressed.
- a selected_disabled state.
Events
All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
- type: The event type.
- target: The target that generated the event.
- show: The visible property has been set to true at runtime.
- hide: The visible property has been set to false at runtime.
- focusIn: The component has received focus.
- focusOut: The component has lost focus.
- select: The component's selected property has changed.
- selected: The selected property of the Button. Boolean type.
- stateChange: The button's state has changed.
- state: The Button's new state. String type. Values "up", "over", "down", etc.
- rollOver: The mouse cursor has rolled over the button.
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
- rollOut: The mouse cursor has rolled out of the button.
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
- press: The button has been pressed.
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments).Number type. Values 0 to 3.
- doubleClick: The button has been double clicked. Only fired when the Button.doubleClickEnabled property is true.
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
- click: The button has been clicked.
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
- dragOver: The mouse cursor has been dragged over the button (while the left mouse button is pressed).
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
- dragOut: The mouse cursor has been dragged out of the button (while the left mouse button is pressed).
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
- releaseOutside: The mouse cursor has been dragged out of the button and the left mouse button has been released.
- controllerIdx: The index of the mouse cursor used to generate the event (applicable only for multi-mouse-cursor environments). Number type. Values 0 to 3.
Component metadata:
| InspectableList | "autoSize" "data" "disableConstraints" "disabled" "enableInitCallback" "labelID" "selected" "soundMap" "visible" |
|---|
Summary
Constructor
Instance properties
Instance properties inherited from Button
_autoSize _disableConstraints _disableFocus _group _label _selected autoRepeat autoSize buttonRepeatDelay buttonRepeatDuration buttonRepeatInterval constraints data disableConstraints disabled disableFocus doubleClickDuration doubleClickEnabled doubleClickInterval focusIndicator group groupName inspectableGroupName label labelID lockDragStateChange pressedByKeyboard selected soundMap state stateMap textField toggle
Instance properties inherited from UIComponent
__height __width _disabled _displayFocus _focused addEventListener cleanUpEvents disabled dispatchEvent displayFocus enableInitCallback focused focusHandlerReference focusTarget hasEventListener height initialized invalidationIntervalID removeAllEventListeners removeEventListener sizeIsInvalid soundMap visible width
Class methods
Class methods inherited from UIComponent
Instance methods
Instance methods inherited from Button
alignForAutoSize beginButtonRepeat calculateWidth changeFocus clearRepeatInterval configUI doubleClickExpired draw getStatePrefixes handleButtonRepeat handleClick handleDragOut handleDragOver handleInput handleMousePress handleMouseRelease handleMouseRollOut handleMouseRollOver handlePress handleRelease handleReleaseOutside setSize setState toString updateAfterStateChange
Instance methods inherited from UIComponent
Constructor
CheckBox
function CheckBox (
)
The constructor is called when a CheckBox or a sub-class of CheckBox is instantiated on stage or by using
attachMovie() in ActionScript. This component can not be instantiated using new syntax. When creating new components that extend CheckBox, ensure that a super() call is made made first in the constructor.